{__NOLAYOUT__}<!DOCTYPE html>
<html lang="zh_cn">

<head>
  <meta charset="utf-8">
  <!--渲染器-->
  <meta name="renderer" content="webkit">
  <!--优先使用最新版本的IE 和 Chrome 内核-->
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>后台管理</title>
  <link rel="stylesheet" href="/static/plugins/layui/css/layui.css" media="all" />
  <link rel="stylesheet" href="/static/admin/css/login.css" />
  <link rel="stylesheet" href="/static/admin/css/font.css" />
  <script type="text/javascript" src="/static/plugins/layui/layui.js"></script>
  <script src="/static/common/jquery/jquery.min.js"></script>
  <script>
    layui.use('layer',
      function () {
        var $ = layui.jquery, layer = layui.layer;
      })
  </script>
</head>

<body class="beg-login-bg">
  <div class="container login">
    <div class="content">
      <div id="large-header" class="large-header">
        <canvas id="demo-canvas"></canvas>
        <div class="main-title">
          <div class="beg-login-box">
            <header>
              <h1>{$system.name}</h1>
            </header>
            <div class="beg-login-main">
              <form class="layui-form layui-form-pane" method="post">
                <div class="layui-form-item">
                  <label class="beg-login-icon fs1">
                    <span class="icon icon-user"></span>
                  </label>
                  <input type="text" name="username" lay-verify="required" 
                    placeholder="这里输入登录名" class="layui-input">
                </div>
                <div class="layui-form-item">
                  <label class="beg-login-icon fs1">
                    <i class="icon icon-key"></i>
                  </label>
                  <input type="password" name="password" lay-verify="required" 
                    placeholder="这里输入密码" class="layui-input">
                </div>
                {if $system.code}
                  <div class="layui-form-item">
                    <div class="layui-row">
                      <div class="layui-col-xs5">
                        <label class="beg-login-icon fs1" for="LAY-user-login-vercode">
                          <span class="layadmin-user-login-icon layui-icon layui-icon-vercode"></span>
                        </label>
                        <input type="text" name="vercode" id="LAY-user-login-vercode" lay-verify="required"
                          placeholder="验证码" class="layui-input">
                      </div>
                      <div class="layui-col-xs7">
                        <div class="captcha">
                          <img src="{:url('Login/captcha')}" class="layadmin-user-login-codeimg"
                            id="LAY-user-get-vercode">
                        </div>
                      </div>
                    </div>
                  </div>
                {/if}
                <div class="layui-form-item">
                  <input type="hidden" name="__token__" value="{:token()}"/>
                  <button type="submit" class="layui-btn btn-submit btn-blog" lay-submit lay-filter="login">登录</button>
                </div>
              </form>
            </div>
          <footer>
            <p>作者 © 931274989@qq.com</p>
          </footer>
          </div>
        </div>
      </div>
    </div>
  </div>
<script src="/static/admin/js/rAF.js"></script>
<script src="/static/admin/js/login.js"></script>
<script>
  $(document).keyup(function (event) {
    if (event.keyCode == 13) {
      $(".login").trigger("click");
    }
  });
  $(function () {
    //刷新验证码操作
    $(".layadmin-user-login-codeimg").click(function () {
      $(this).attr("src", $(this).attr("src") + '?' + Math.random());
    })
    //后台登录
    $(".layui-btn").click(function () {
      var username = $("input[name='username']").val();
      var password = $("input[name='password']").val();
      var __token__ = $("input[name='__token__']").val();
      var vercode = $("input[name='vercode']").val();
      $.ajax({
        type: "post",
        url: "{:url('checkLogin')}",
        data: {
          username: username,
          password: password,
          vercode: vercode,
          __token__: __token__
        },
        dataType: "json",
        success: function (data) {
          if (data.error == 1) {
            layer.alert(data.msg, {
              icon: 2
            });
          } else {
            layer.load();
            window.location.href = data.url;
          }
        },
        error: function (xhr) {

        }
      });
      return false;
    })
  })
</script>
</body>
</html>